﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Xinkui.WebModel.BasicControl;
using Xinkui.DataAccess.AutoGenerator;
using Xinkui.Common;
using Xinkui.WebModel.Data;
using Xinkui.WebModel;

public partial class UserControl_fore_UC_Buyleads : ForeControl {

    private int _PageSize = 6;
    public int PageSize {
        get {
            return _PageSize;
        }
        set {
            if (_PageSize == value)
                return;
            _PageSize = value;
        }
    }
    protected void Page_Load(object sender, EventArgs e) {

        var query = SearchQueryData.Create();
        int total = 0;

        this.rptDataSource.DataSource = Singleton<BuyleadInfoDataAccess>.Instance.ListBuyleads(query.PageIndex, PageSize, query.CategoryLevel1, query.Keyword, 0, out total);
        this.rptDataSource.DataBind();

        if (total <= 0) {
            rptDataSource.Visible = false;
            UC_RewritePager1.Visible = false;
        }
        else {

            UC_RewritePager1.FormatUrl = true;
            UC_RewritePager1.CoverNav = false;

            this.UC_RewritePager1.NoteTotal = total;
            this.UC_RewritePager1.JumpUrl = URLHelper.LinkToBuyleads() + "?p={0}";//"ProductListForImage.aspx?com=1&p={0}";//JumpUrl;
            this.UC_RewritePager1.PageIndex = query.PageIndex;
            this.UC_RewritePager1.PageSize = PageSize;
        }

    }
}